<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.thymeleaf.org/extras/spring-security">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>OA办公系统 - 首页</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        body {
            font-family: 'Microsoft YaHei', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
            min-height: 100vh;
        }
        
        .header {
            background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
            color: white;
            padding: 1rem 2rem;
            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
        }
        
        .nav {
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        
        .logo {
            font-size: 1.5rem;
            font-weight: bold;
        }
        
        .user-info {
            display: flex;
            align-items: center;
            gap: 1rem;
        }
        
        .welcome-text {
            font-size: 0.9rem;
        }
        
        .logout-btn {
            background: rgba(255,255,255,0.2);
            border: 1px solid rgba(255,255,255,0.3);
            color: white;
            padding: 0.5rem 1rem;
            border-radius: 5px;
            text-decoration: none;
            transition: all 0.3s ease;
        }
        
        .logout-btn:hover {
            background: rgba(255,255,255,0.3);
            text-decoration: none;
            color: white;
        }
        
        .main-content {
            padding: 2rem;
            max-width: 1200px;
            margin: 0 auto;
        }
        
        .welcome-banner {
            background: white;
            border-radius: 15px;
            padding: 2rem;
            margin-bottom: 2rem;
            box-shadow: 0 4px 15px rgba(0,0,0,0.1);
            text-align: center;
        }
        
        .welcome-banner h1 {
            color: #4f46e5;
            margin-bottom: 1rem;
            font-size: 2.5rem;
        }
        
        .welcome-banner p {
            color: #666;
            font-size: 1.1rem;
        }
        
        .features-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
            gap: 2rem;
            margin-bottom: 2rem;
        }
        
        .feature-card {
            background: white;
            border-radius: 15px;
            padding: 2rem;
            box-shadow: 0 4px 15px rgba(0,0,0,0.1);
            transition: transform 0.3s ease, box-shadow 0.3s ease;
        }
        
        .feature-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 8px 25px rgba(0,0,0,0.15);
        }
        
        .feature-icon {
            font-size: 3rem;
            margin-bottom: 1rem;
        }
        
        .feature-title {
            color: #4f46e5;
            font-size: 1.5rem;
            margin-bottom: 1rem;
        }
        
        .feature-desc {
            color: #666;
            line-height: 1.6;
            margin-bottom: 1.5rem;
        }
        
        .feature-btn {
            background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
            color: white;
            padding: 0.75rem 1.5rem;
            border-radius: 8px;
            text-decoration: none;
            display: inline-block;
            transition: transform 0.3s ease;
        }
        
        .feature-btn:hover {
            transform: scale(1.05);
            text-decoration: none;
            color: white;
        }
        
        .quick-stats {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            gap: 1rem;
            margin-bottom: 2rem;
        }
        
        .stat-card {
            background: white;
            border-radius: 10px;
            padding: 1.5rem;
            text-align: center;
            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
        }
        
        .stat-number {
            font-size: 2rem;
            font-weight: bold;
            color: #4f46e5;
        }
        
        .stat-label {
            color: #666;
            margin-top: 0.5rem;
        }
        
        .system-info {
            background: white;
            border-radius: 15px;
            padding: 1.5rem;
            box-shadow: 0 4px 15px rgba(0,0,0,0.1);
            border-left: 4px solid #10b981;
        }
        
        .status-dot {
            width: 8px;
            height: 8px;
            background: #10b981;
            border-radius: 50%;
            display: inline-block;
            margin-right: 8px;
            animation: pulse 2s infinite;
        }
        
        @keyframes pulse {
            0% { opacity: 1; }
            50% { opacity: 0.5; }
            100% { opacity: 1; }
        }
    </style>
</head>
<body>
    <div class="header">
        <nav class="nav">
            <div class="logo">🏢 OA办公系统</div>
            <div class="user-info" sec:authorize="isAuthenticated()">
                <span class="welcome-text">欢迎，<span sec:authentication="name">用户</span></span>
                <a href="/logout" class="logout-btn">退出登录</a>
            </div>
        </nav>
    </div>
    
    <div class="main-content">
        <div class="welcome-banner">
            <h1>欢迎使用OA办公系统</h1>
            <p>高效办公，智能协作，让工作更简单</p>
            
            <!-- 已登录状态标记 -->
            <div style="background-color: #dcfce7; color: #16a34a; padding: 10px; border-radius: 5px; margin-top: 15px; font-weight: bold; border: 1px solid #16a34a; display: inline-block;">
                <span style="font-size: 16px;">✅ 当前状态：已登录</span>
            </div>
        </div>
        
        <div class="quick-stats">
            <div class="stat-card">
                <div class="stat-number">15</div>
                <div class="stat-label">待审批事项</div>
            </div>
            <div class="stat-card">
                <div class="stat-number">28</div>
                <div class="stat-label">待办任务</div>
            </div>
            <div class="stat-card">
                <div class="stat-number">5</div>
                <div class="stat-label">新消息</div>
            </div>
            <div class="stat-card">
                <div class="stat-number">12</div>
                <div class="stat-label">待阅文档</div>
            </div>
        </div>
        
        <div class="features-grid">
            <div class="feature-card">
                <div class="feature-icon">📄</div>
                <h3 class="feature-title">文档管理</h3>
                <p class="feature-desc">在线文档编辑、版本控制、协作共享，提升文档管理效率</p>
                <a href="/documents" class="feature-btn">立即使用</a>
            </div>
            
            <div class="feature-card">
                <div class="feature-icon">🔄</div>
                <h3 class="feature-title">工作流程</h3>
                <p class="feature-desc">智能流程设计、自动化审批、状态跟踪，简化业务流程</p>
                <a href="/workflows" class="feature-btn">立即使用</a>
            </div>
            
            <div class="feature-card">
                <div class="feature-icon">📊</div>
                <h3 class="feature-title">数据统计</h3>
                <p class="feature-desc">实时数据分析、可视化图表、智能报表生成</p>
                <a href="/dashboard" class="feature-btn">查看统计</a>
            </div>
            
            <div class="feature-card">
                <div class="feature-icon">⚙️</div>
                <h3 class="feature-title">系统管理</h3>
                <p class="feature-desc">用户管理、权限配置、系统设置，全面的管理功能</p>
                <a href="/admin" class="feature-btn">管理设置</a>
            </div>
        </div>
        
        <div class="system-info">
            <h4><span class="status-dot"></span>系统状态</h4>
            <p>所有服务运行正常 | 上次更新：<span id="current-time"></span></p>
        </div>
    </div>
    
    <script>
        // 显示当前时间
        function updateTime() {
            const now = new Date();
            const timeString = now.toLocaleString('zh-CN');
            document.getElementById('current-time').textContent = timeString;
        }
        
        updateTime();
        setInterval(updateTime, 1000);
        
        // 模拟动态数据更新
        function updateStats() {
            const stats = document.querySelectorAll('.stat-number');
            stats.forEach(stat => {
                const currentValue = parseInt(stat.textContent);
                const newValue = Math.max(0, currentValue + Math.floor(Math.random() * 3 - 1));
                stat.textContent = newValue;
            });
        }
        
        // 每30秒更新一次统计数据
        setInterval(updateStats, 30000);
    </script>
</body>
</html>